package com.panshi.bean;

import lombok.Data;

import java.util.List;

@Data
public class PageBean<T> {

    // 当前页
    private Integer currentPage;
    // 每页显示的总条数
    private Integer currentPageSize;
    // 总条数
    private Long totalNum;
    // 是否有下一页
    private Integer isMore;
    // 总页数
    private Integer totalPage;
    // 开始索引
    private Integer startIndex;
    // 分页结果
    private List<T> CollectPo;

    public PageBean() {
        super();
    }

    public PageBean(Integer currentPage, Integer currentPageSize, Long totalNum) {
        super();
        this.currentPage = currentPage;
        this.currentPageSize = currentPageSize;
        this.totalNum = totalNum;
        this.totalPage = (Integer.parseInt(this.totalNum.toString())+this.currentPageSize-1)/this.currentPageSize;
        this.startIndex = (this.currentPage-1)*this.currentPageSize;
        this.isMore = this.currentPage >= this.totalPage?0:1;
    }


}
